package cemp.enums;

import com.alibaba.cloud.commons.lang.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum MessageEnum {

    /**
     * 签到提醒
     */
    COME_NOTIFY("01", "签到提醒","2IY8bSwN-Dm4YiAvyy-2PZSSDUweHIdJDy79NJaIH9c"),
    /**
     * 工作任务通知
     */
    TASK_INFORM("02", "工作任务通知","hGv1cxOSY9h4XjL8gGeN3yhU37GXuVJw91Mo8xLm_F0"),
    ;

    private final String code;
    private final String name;
    private final String templateid;

    public static MessageEnum fromName(String name) {
        for (MessageEnum value : MessageEnum.values()) {
            if (name.equals(value.getName())) {
                return value;
            }
        }
        return null;
    }

    public static MessageEnum fromCode(String code) {
        for (MessageEnum value : MessageEnum.values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return null;
    }

    public static String getName(String code) {
        for (MessageEnum value : MessageEnum.values()) {
            if (StringUtils.equals(value.getCode(),code)) {
                return value.getName();
            }
        }
        return null;
    }
}
